package main

import (
	"fmt"
	"time"
)

func main() {
	mainChan := make(chan int)
	receivers := 3
	for i := 0; i < receivers; i++ {
		go func(index int, c <-chan int) {
			for {
				select {
				case msg := <-c:
					fmt.Printf("receiver %d receiverd: %v\n", index, msg)

				}
			}
		}(i, mainChan)
	}
	//for i := 0; ; i++ {
	mainChan <- 10
	time.Sleep(time.Second)
	//}
}
